#include<stdio.h>

int main()
{
	FILE *fp;
	unsigned char *bmpbuf;
	unsigned int bmpLen = 0;

	if (fp = fopen("test.bmp", "r"))
	{
		fseek(fp, 0, SEEK_END);		// move to end
		bmpLen = ftell(fp);			// get file size

		fseek(fp, 0, SEEK_SET);		// move to start
		bmpbuf = new unsigned char[bmpLen];

		fread(&bmpbuf[0], sizeof(unsigned char), bmpLen, fp);

		for (int i = 0; i < bmpLen; i++)
			printf("%02X ", bmpbuf[i]);

		fclose(fp);
	}
	else
	{
		return -1;
	}

	delete[] bmpbuf;
	return 0;
}
